<template>
  <HerinContainer class="MainCoal-box" :delay="1" direction="Right" title="掘进机运行监测">
    <div slot="content" class="center">
      <div class="center-item" v-for="(item, index) in cateLists" :key="index">
        <div>
          <img v-if="item.cam !== '℃'" class="img" src="@/assets/img/excavation/icon-a.png" alt="">
          <span class="title">{{ item.title }}</span>
        </div>
        <div :style="{'color':color(item.num)}">
          <span class="num">{{ item.num }}</span
          ><span class="cam">{{ item.cam }}</span>
        </div>
      </div>
    </div>
  </HerinContainer>
</template>

<script>
import HerinContainer from '@/components/HerinContainer';
export default {
  data() {
    return {};
  },

  components: {
    HerinContainer
  },

  computed: {
    cateLists() {
      return [
        { title: '泵', num: '64.3', cam: 'A' },
        { title: '运输机', num: '62.1', cam: 'A' },
        { title: '左装载机', num: '90.1', cam: 'A' },
        { title: '截割部', num: '95.2', cam: 'A' },
        { title: '截割部变速箱', num: '59.1', cam: '℃' },
        { title: '右装载机', num: '89.8', cam: 'A' }
      ];
    },
    color() {
      return function(num) {
        const value = (num * 1);
        let str = '';
        if (value >= 62 && value <= 90) {
          str = '#57FFAA';
        } else if (value < 62) {
          str = '#FFD101';
        } else if (value > 90) {
          str = '#FF4101';
        }
        return str;
      };
    }
  },

  methods: {}
};
</script>
<style scoped lang="scss">
.center {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  .center-item {
    width: 6.25rem;
    height: 3.125rem;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.25rem;
    background-color: #1d2e45;
    border-radius: 0.25rem;
    margin-bottom: 0.625rem;
    padding: 0.375rem 0;
    box-sizing: border-box;
    .img{
      width: .875rem;
      height: .875rem;
      margin-right: .3125rem;
      vertical-align: middle;
    }
    .title {
      color: #d5d7d9;
      vertical-align: middle;
    }
  }
  .center-item:nth-child(4),.center-item:nth-child(5),.center-item:nth-child(6){
    margin-bottom: 0;
  }
}
</style>
